package com.ruoyi.lxzx.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.lxzx.mapper.UserCircleLikeMapper;
import com.ruoyi.lxzx.domain.UserCircleLike;
import com.ruoyi.lxzx.service.IUserCircleLikeService;

/**
 * 点赞管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-10-26
 */
@Service
public class UserCircleLikeServiceImpl implements IUserCircleLikeService 
{
    @Autowired
    private UserCircleLikeMapper userCircleLikeMapper;

    /**
     * 查询点赞管理
     * 
     * @param id 点赞管理主键
     * @return 点赞管理
     */
    @Override
    public UserCircleLike selectUserCircleLikeById(Long id)
    {
        return userCircleLikeMapper.selectUserCircleLikeById(id);
    }

    /**
     * 查询点赞管理列表
     * 
     * @param userCircleLike 点赞管理
     * @return 点赞管理
     */
    @Override
    public List<UserCircleLike> selectUserCircleLikeList(UserCircleLike userCircleLike)
    {
        return userCircleLikeMapper.selectUserCircleLikeList(userCircleLike);
    }

    /**
     * 新增点赞管理
     * 
     * @param userCircleLike 点赞管理
     * @return 结果
     */
    @Override
    public int insertUserCircleLike(UserCircleLike userCircleLike)
    {
        userCircleLike.setCreateTime(DateUtils.getNowDate());
        return userCircleLikeMapper.insertUserCircleLike(userCircleLike);
    }

    /**
     * 修改点赞管理
     * 
     * @param userCircleLike 点赞管理
     * @return 结果
     */
    @Override
    public int updateUserCircleLike(UserCircleLike userCircleLike)
    {
        userCircleLike.setUpdateTime(DateUtils.getNowDate());
        return userCircleLikeMapper.updateUserCircleLike(userCircleLike);
    }

    /**
     * 批量删除点赞管理
     * 
     * @param ids 需要删除的点赞管理主键
     * @return 结果
     */
    @Override
    public int deleteUserCircleLikeByIds(Long[] ids)
    {
        return userCircleLikeMapper.deleteUserCircleLikeByIds(ids);
    }

    /**
     * 删除点赞管理信息
     *
     * @param circleId    点赞管理主键
     * @param finalUserId
     * @return 结果
     */
    @Override
    public int deleteUserCircleLikeById(Long circleId, Long finalUserId)
    {
        return userCircleLikeMapper.deleteByUserId(circleId,finalUserId);
    }

    @Override
    public int xmdz(Long circleId, Long userId) {
        UserCircleLike userCircleLike = new UserCircleLike();
        userCircleLike.setCircleId(circleId);
        userCircleLike.setCircleUserId(userId);
        userCircleLike.setCreateBy(userId+"");
        userCircleLike.setCreateTime(DateUtils.getNowDate());
        return userCircleLikeMapper.insertUserCircleLike(userCircleLike);
    }
}
